<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * @see Mage_Page_Block_Template_Links
 */
?>
<?php
$additional_links = false;
if (Mage::getSingleton('customer/session')->isLoggedIn() == false && Mage::getStoreConfig('shoppersettings/header/top_signup')) {
	$additional_links = true;
}
if (Mage::getStoreConfig('shoppersettings/header/top_custom_link')) {
	$additional_links = true;
}
?>
<?php $_links = $this->getLinks(); ?>
<?php if(count($_links)>0 || $additional_links ): ?>
<ul class="links"<?php if($this->getName()): ?> id="<?php echo $this->getName() ?>"<?php endif;?>>
	<?php if (Mage::getStoreConfig('shoppersettings/header/top_custom_link')): ?>
        <li><a href="<?php echo Mage::getURL( Mage::getStoreConfig('shoppersettings/header/top_custom_link_path') ) ?>" title="<?php echo Mage::getStoreConfig('shoppersettings/header/top_custom_link_title') ?>"><?php echo Mage::getStoreConfig('shoppersettings/header/top_custom_link_anchor') ?></a></li>
		<li class="separator">&nbsp;</li>
    <?php endif; ?>
    <?php foreach($_links as $_link): ?>
        <?php if ($_link instanceof Mage_Core_Block_Abstract):?>
            <?php echo $link_content = $_link->toHtml() ?>
			<?php if(!$_link->getIsLast() && !empty($link_content)): ?>
            <li class="separator">&nbsp;</li>
			<?php endif; ?>
        <?php else: ?>
            <li <?php echo $_link->getLiParams() ?>><?php echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><?php echo $_link->getLabel() ?></a><?php echo $_link->getAfterText() ?></li>
			<?php if(!$_link->getIsLast()): ?>
            <li class="separator">&nbsp;</li>
			<?php endif; ?>
        <?php endif;?>
    <?php endforeach; ?>
    <?php if (Mage::getSingleton('customer/session')->isLoggedIn() == false && Mage::getStoreConfig('shoppersettings/header/top_signup')): ?>
    <li class="separator">&nbsp;</li>
        <li><a href="<?php echo Mage::getURL('customer/account/create/') ?>"><?php echo $this->__('Sign Up') ?></a></li>
    <?php endif; ?>
</ul>
<?php endif; ?>
